package behaviorPattern.observer.jdk9;

/**
 * @author : Alex Hu
 * date : 2020/3/22 上午09:44
 * description :
 */
public class Java9DemoClient {
    public static void main(String[] args) {
        Java9DemoObserver java9DemoObserver = new Java9DemoObserver("oldname");
        java9DemoObserver.addPropertyChangeListener(evt -> {
            System.out.println("    OldValue: " + evt.getOldValue());
            System.out.println("    NewValue: " + evt.getNewValue());
            System.out.println("PropertyName: " + evt.getPropertyName());
        });
        //设置新名字
        java9DemoObserver.setDemoName("new Name");
    }
}

